import React, {Component} from 'react'
import {
    Text,
    Image,
    View,
    StyleSheet,
    Button,
    TextInput
} from 'react-native'

export default class Page5 extends Component {
    constructor(props) {
        super(props)

    }

    render() {
        const {navigation} = this.props;
        const {state, setParams} = navigation;
        return (
            <View style={styles.container}>
                <Text style={styles.text}>
                    欢迎来到page5
                </Text>

                <Button
                    title="Go back"
                    onPress={() => {
                        navigation.goBack();
                    }}
                />

                <TextInput style={styles.input}
                           onChangeText={text => {
                               setParams({title: text})
                           }}
                >

                </TextInput>

                <Button
                    title="Open Dwarer"
                    onPress={()=>{
                        navigation.openDrawer();
                    }}
                />

                <Button
                    title="Toggle Dwarer"
                    onPress={()=>{
                        navigation.toggleDrawer();
                    }}
                />

                <Button
                    title="GO to Page4"
                    onPress={()=>{
                        navigation.navigate('Page4')
                    }}
                />

            </View>
        )
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#F5FCFF',
    },
    page1: {
        flex: 1,
        backgroundColor: 'red'
    },
    page2: {
        flex: 1,
        backgroundColor: 'blue'
    },
    image: {
        width: 22,
        height: 22
    },
    text: {
        fontSize: 20,
        color: 'black'
    },
    input: {
        height: 50,
        width:200,
        borderWidth: 1,
        marginTop: 10,
        borderColor: 'black'
    }
})